import { Injectable } from '@angular/core';
import { RestService } from '@abp/ng.core';
import { CreateUpdateCarInventryDto, CarInventryDto } from './models';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class CarInventryService {
  apiName = 'Default';

  constructor(private restService: RestService) {}

  getList(params: any = {}): Observable<any> {
    return this.restService.request<any, any>({
      method: 'GET',
      url: '/api/app/car-inventry',
      params
    });
  }

  getById(id: string): Observable<CarInventryDto> {
    return this.restService.request<any, CarInventryDto>({
      method: 'GET',
      url: `/api/app/car-inventry/${id}`
    });
  }

  create(input: CreateUpdateCarInventryDto): Observable<CarInventryDto> {
    return this.restService.request<any, CarInventryDto>({
      method: 'POST',
      url: '/api/app/car-inventry',
      body: input
    });
  }

  update(id: string, input: CreateUpdateCarInventryDto): Observable<CarInventryDto> {
    return this.restService.request<any, CarInventryDto>({
      method: 'PUT',
      url: `/api/app/car-inventry/${id}`,
      body: input
    });
  }

  delete(id: string): Observable<void> {
    return this.restService.request<any, void>({
      method: 'DELETE',
      url: `/api/app/car-inventry/${id}`
    });
  }
} 